EDA: Demographic

Row

Overview

This is a dashboard for the visualization of the Student Alcohol Consumption dataset.

This dashboard provides exploratory data analysis of some important features of the dataset, like the final grade of the student, the time students’ devoted to studying everyweek, whether students had extra educational support, parent’s cohabitation status, parent’s education level and their weekly alcohol consumption level.

Row

Sex

Row

Age

EDA: Family

Row

Parent’s Cohabitation Status

Row

Father’s Education

Mother’s Education

EDA: Alcohol Consumption

Column

Weekday Alcohol Consumption

Column

Weekend Alcohol Consumption

---
title: "Student Alcohol Consumption"
output: 
  flexdashboard::flex_dashboard:
    vertical_layout: fill
    storyboard: true
    social: menu
    source: embed
---

```{r setup, include=FALSE}
library(flexdashboard)
setwd("~/Desktop/Data Visualization/Final Project")
library(readr)
library(tidyverse)
library(plotly)
library(waffle)
library("RColorBrewer")
library(ggplot2)
library(gganimate)
library(gifski)
library("ggiraph")
library("ggiraphExtra")
library(mgcv)
require(predict3d)
require(rgl)
dta <- read_csv("dta.csv")
```
EDA: Demographic
=======================================================================
Row
-----------------------------------------------------------------------
### Overview
This is a dashboard for the visualization of the Student Alcohol Consumption dataset.

This dashboard provides exploratory data analysis of some important features of the dataset, like the final grade of the student, the time students' devoted to studying everyweek, whether students had extra educational support, parent's cohabitation status, parent's education level and their weekly alcohol consumption level. 


Row
-----------------------------------------------------------------------
### Sex
```{r}
#Creating Waffle chart
sex <- dta %>%count(sex)
sex <- c("Male" = 453, "Female" = 591)
Waffle <- waffle(sex/10, rows = 10, size = .5,
                 colors= c('steelblue4',"violetred4"), 
                 title="Gender Distribution of the Dataset", 
                 xlab="1 Square = 10 Students")
Waffle
```

Row
-----------------------------------------------------------------------
### Age
```{r}
age <- dta %>%count(age)
age_plot <- plot_ly(age,
  x = ~age,
  y = ~n,
  name = "Age Distribution of the Dataset",
  type = "bar"
)

age_plot <- age_plot %>% layout(title = 'Age Distribution of the Dataset',
         xaxis = list(title = "Age"),
         yaxis = list(title = "Counts"))
age_plot
```



EDA: School Related
=======================================================================

Row
-----------------------------------------------------------------------
### Final GPA
```{r}
final_grade <- dta %>%count(G3)

GRADE_plot <- plot_ly(final_grade,
  x = ~G3,
  y = ~n,
  name = "Final Grade Distribution of the Dataset",
  type = "bar"
)

GRADE_plot <- GRADE_plot %>% layout(title = 'Final Grade Distribution of the Dataset',
         xaxis = list(title = "Final Grade"),
         yaxis = list(title = "Counts"))
GRADE_plot
```

Row {.tabset}
-------------------------------------
### Study Time Distribution
```{r}
study <- dta %>%count(studytime)
study_plot <- plot_ly(study,
  x = ~studytime,
  y = ~n,
  name = "Study Time Distribution of the Dataset",
  type = "bar"
)

study_plot <- study_plot %>% layout(title = 'Study Time Distribution of the Dataset',
         xaxis = list(title = "Study Time"),
         yaxis = list(title = "Counts"))
study_plot
```

### Additional Educational Support Distribution
```{r}
addition <- dta %>%count(schoolsup)
addition_1 <- c("No" = 925, "Yes" = 119)
Waffle_addition <- waffle(addition_1/10, rows = 10, size = .5,
                 colors= c('mistyrose4',"maroon"), 
                 title="Additional Educational Support Status Distribution of the Dataset", 
                 xlab="1 Square = 10 Students")
Waffle_addition
```

EDA: Family
=======================================================================
Row
-----------------------------------------------------------------------
### Parent's Cohabitation Status
```{r}
maritial <- dta %>%count(Pstatus)
maritial_1 <- c("Together" = 923, "Apart" = 121)
Waffle_m <- waffle(maritial_1/10, rows = 10, size = .5,
                 colors= c('maroon4',"slategrey"), 
                 title="Parent's Cohabitation Status Distribution of the Dataset", 
                 xlab="1 Square = 10 Students")
Waffle_m
```

Row
-----------------------------------------------------------------------
### Father's Education
```{r}
Fedu <- dta %>%count(Fedu)
Fedu$Fedu <- c('None','4th Grade', "5th to 9th Grade","Secondary Education","Higher Education")
faedu = c('None' = 9, '4th Grade' = 256, "5th to 9th Grade" = 324, "Secondary Education" = 231, "Higher Education" = 224)
faedu_plot <- plot_ly(Fedu,
                      x = ~Fedu,
                      y = ~n,
                      name = "Father's Education Level Distribution of the Dataset",
                      type = "bar"
)

faedu_plot <- faedu_plot %>% layout(title = "Father's Education Level Distribution of the Dataset",
         xaxis = list(title = "Education Level",
                      categoryorder = "array",
                      categoryarray = c('None','4th Grade', "5th to 9th Grade","Secondary Education","Higher Education")),
         yaxis = list(title = "Counts"))
faedu_plot
```

### Mother's Education
```{r}
Medu <- dta %>%count(Medu)
Medu$Medu <- c('None','4th Grade', "5th to 9th Grade","Secondary Education","Higher Education")
maedu = c('None' = 9, '4th Grade' = 202, "5th to 9th Grade" = 289, "Secondary Education" = 238, "Higher Education" = 306)
maedu_plot <- plot_ly(Medu,
                      x = ~Medu,
                      y = ~n,
                      name = "Mother's Education Level Distribution of the Dataset",
                      type = "bar"
)

maedu_plot <- maedu_plot %>% layout(title = "Mother's Education Level Distribution of the Dataset",
         xaxis = list(title = "Education Level",
                      categoryorder = "array",
                      categoryarray = c('None','4th Grade', "5th to 9th Grade","Secondary Education","Higher Education")),
         yaxis = list(title = "Counts"))
maedu_plot
```

EDA: Alcohol Consumption
=======================================================================
Column
-----------------------------------------------------------------------
### Weekday Alcohol Consumption
```{r}
dalc <- dta %>%count(Dalc)
dalc_plot <- plot_ly(dalc,
  x = ~Dalc,
  y = ~n,
  name = "Weekday Alcohol Consumption Distribution of the Dataset",
  type = "bar"
)

dalc_plot <- dalc_plot %>% layout(title = 'Weekday Alcohol Consumption Distribution of the Dataset',
         xaxis = list(title = "Weekday Alcohol Consumption"),
         yaxis = list(title = "Counts"))
dalc_plot
```

Column
-----------------------------------------------------------------------
### Weekend Alcohol Consumption
```{r}
walc <- dta %>%count(Walc)
walc_plot <- plot_ly(walc,
  x = ~Walc,
  y = ~n,
  name = "Weekend Alcohol Consumption Distribution of the Dataset",
  type = "bar"
)

walc_plot <- walc_plot %>% layout(title = 'Weekend Alcohol Consumption Distribution of the Dataset',
         xaxis = list(title = "Weekend Alcohol Consumption"),
         yaxis = list(title = "Counts"))
walc_plot
```